/**
 * 求两个数的最小公倍数
 * 先求出最大公约数，然后两数相乘再除以最大公约数
 * */

var minCommonMultiple = function(x, y){

    var tmp = 0;
    var a = x;
    var b = y;
    //var maxComDiv = 1;

    //使a大于b
    if(a < b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }

    while (a%b != 0)
    {
        a = a%b;
        if(a < b)
        {
            tmp = a;
            a = b;
            b = tmp;
        }
    }
    //此时的b为最大公约数,最小公倍数就x乘于y然后除于b
    return (x*y)/b;
}


var a = 315;
var b = 819;

var res = minCommonMultiple(a, b);
console.log(res);
